﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EtlComm;

namespace EtlLog
{
    /// <summary>
    /// 数据库日志
    /// </summary>
    public class DBLog:BaseLog
    {
        log4net.ILog _log;

        public DBLog()
        {
            _log = log4net.LogManager.GetLogger("AdoNetAppender");
        }

        public override bool WriteLog(string loginfo)
        {
            base.WriteLog(loginfo);
            return true;
        }

        public override bool WriteDebugLog(string szFormat, params object[] Params)
        {
            _log.Debug(string.Format(szFormat, Params));
            return base.WriteDebugLog(szFormat, Params);
        }

        public override bool WriteErrorLog(string szFormat, params object[] Params)
        {
            _log.Error(string.Format(szFormat, Params));
            return base.WriteErrorLog(szFormat, Params);
        }

        public override bool WriteInfoLog(string szFormat, params object[] Params)
        {
            _log.Info(string.Format(szFormat, Params));
            return base.WriteInfoLog(szFormat, Params);
        }

        public override bool WriteWarnLog(string szFormat, params object[] Params)
        {
            _log.Warn(string.Format(szFormat, Params));
            return base.WriteWarnLog(szFormat, Params);
        }

        public override bool WriteFatalLog(string szFormat, params object[] Params)
        {
            _log.Fatal(string.Format(szFormat, Params));
            return base.WriteFatalLog(szFormat, Params);
        }
    }
}
